
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>评价中心</title>
    <script src="../js/jquery-3.4.1min.js"></script>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <script src="../js/popper.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <script type="text/javascript">
        var aaid;
        $(function(){

            $("#fafafa").click(function(){
                var content = $("#message-text").val()
                console.log($("#message-text").val())
                $.ajax({
                    url:"/assess/updateAssessByAid",
                    //eid,acontent
                    data:{"aid":aaid,"acontent":content},
                    type:"post",
                    dateType:"json",
                    success:function (data){
                        if(data.code==200){
                            $("#updateIng").empty();
                            $("#updateIng").append("<a href='/assess/getAllAssessByUIdByPage' class='card-link'>修改成功，点击刷新！</a>");
                        }else{
                            alert('修改失败')
                        }
                    }
                })
            })
        })
        function fun(aid) {
            aaid=aid
        }
    </script>
</head>
<body>
<div class="container">
    <table class="table">
        <thead>
        <tr>
            <th>评价号</th>
            <th>展览名</th>
            <th>评价内容</th>
            <th>评价时间</th>
            <th>
                操作
        </tr>
        </thead>
        <tbody>

        <c:forEach items="${assess1}" var="assess" varStatus="status">
            <tr>
                <td>${assess.aid}</td>
                <td>${assess.exhibition.etitle}</td>
                <td>${assess.acontent}</td>
                <td>
                    <fmt:formatDate value="${assess.atime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </td>
                <td>
                    <button type="button" onclick="fun(${assess.aid})" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@mdo">修改</button>
                    <a href="/assess/delAssessByAid?aid=${assess.aid}" class="btn btn-primary" onclick="return confirm('确认删除?')">删除</a>
                </td>
            </tr>
        </c:forEach>
        <tr>
            <td colspan="8" style="text-align: center">
                <a class="btn btn-outline-success" href="/assess/getAllAssessByUIdByPage?currentPage=1">首页</a>
                <a class="btn btn-outline-success"class="btn btn-outline-success" href="/assess/getAllAssessByUIdByPage?currentPage=${pages.getPrePage()}">上一页</a>
                <c:forEach items="${pages.getPageList()}" var="num">
                    <a class="btn btn-outline-success" href="/assess/getAllAssessByUIdByPage?currentPage=${num}">${num}</a>
                </c:forEach>
                <a class="btn btn-outline-success" href="/assess/getAllAssessByUIdByPage?currentPage=${pages.getNextPage()}">下一页</a>
                <a class="btn btn-outline-success" href="/assess/getAllAssessByUIdByPage?currentPage=${pages.getTotalPage()}">尾页</a>
            </td>
        </tr>
        </tbody>
    </table>

</div>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content" id="updateIng">
            <div class="modal-header">
                <h5 class="modal-title">修改评论</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <form>
                    <div class="form-group">
                        <label for="message-text" class="col-form-label">内容:</label>
                        <textarea class="form-control" id="message-text"></textarea>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                <button type="button" id="fafafa"class="btn btn-primary">修改</button>
            </div>
        </div>
    </div>
</div>
</body>
</html>
